function D = euclidDist(M)
%EUCLIDDIST spocita matici vzdalenosti mezi sloupci matice M
%        M - matice AxB
%        D - matice BxB
%            D(i,j) je euklidovska vzdalenost mezi i-tym a j-tym sloupcem M

[A,B] = size(M);
D = zeros(B);
for i = 1:(B-1)   
    R = M(:,(i+1):B) - M(:,i*ones(B-i,1));  
    D(i,(i+1):B) = sqrt(sum(R .^ 2));
    D((i+1):B,i) = D(i,(i+1):B)';
end
